__author__ = 'nvsmirnov'
# -*- coding: utf-8 -*-

import unittest
from Framework.DataClasses.CUser import *
from Framework.PageClasses.CpLogin import CpLogin
from Framework.PageClasses.CpDefault import CpDefault
from Framework.PageClasses.CpBidding import CpBidding
from Framework.DataClasses.DatabaseData import createDatabaseData
from Tests._tcBase import _tcBase

class Bidding(unittest.TestCase, _tcBase):
    """
    Класс тестирует ставку на аукционе во время торгов
    """
    auction = createDatabaseData()
    auction_id = auction.insertAuction6()
    print "Получили id добавленного аукциона: ", auction_id

    def setUp(self):
        _tcBase.setUpFireFox(self)

    def tearDown(self):
        _tcBase.tearDown(self)
        #_tcBase.clear_ie_cache(self)

    def test_1_bidding(self, id=auction_id):
        #Логин под ролью "Поставщик"
        pageLogin = CpLogin(self.driver)
        pageLogin.open(self.driver, pageLogin.url)
        pageLogin.loginAs( user2 )

        page = CpBidding(self.driver)
        page.openMainPage()
        page.openAuction(id)
        page.fillForm()
        page.submitForm()

        pageDefault = CpDefault(self.driver)
        pageDefault.LogOut()

    def test_2_delete_auction(self, id=auction_id):
        delete_auction = createDatabaseData()
        delete_auction.delete_auction(delete_id=id)

if __name__ == '__main__':
    unittest.main()

